import 'package:get/get.dart';

import '../../config/lf_route.dart';
import '../../service/lf_auth_service.dart';

class LfSplashLogic extends GetxController {
  LfAuthService authService = Get.find<LfAuthService>();
  var showLogin = false.obs;
  @override
  void onReady() {
    super.onReady();
    if (authService.loggedIn()) {
      Future.delayed(const Duration(milliseconds: 300))
          .then((value) => Get.offAllNamed(LFRoute.pathHome));
    } else {
      Future.delayed(const Duration(milliseconds: 1000))
          .then((value) => showLogin.value = true);
    }
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }
}
